package cn.fjsay.java.demo3;

public class Test {
    public static void main(String[] args) {
        double number1 = 10.0;
        double number2 = 20.0;

        // 计算算术平均数
        ComputerMachine.getAverage(new ComputerAverage() {
            @Override
            public double average(double number1, double number2) {
                return (number1 + number2) / 2;
            }
        }, number1, number2);
        System.out.println(); // 换行

        // 计算几何平均数
        ComputerMachine.getAverage(new ComputerAverage() {
            @Override
            public double average(double number1, double number2) {
                return Math.sqrt(number1 * number2);
            }
        }, number1, number2);
    }
}